package com.sven.idrivingfutureserver.util;

import com.github.pagehelper.PageInfo;
import com.sven.idrivingfutureserver.common.BaseRespModel;


import java.util.List;

/**
 * @ClassName PageHelperUtil
 * @Description
 * @Author xiaozhang
 * @Date 2023/1/16 17:22
 * @Version 1.0
 **/
public class PageHelperUtil {
    public static <E> BaseRespModel<E> parseData(List<E> list, BaseRespModel<E> baseRespModel) {
        PageInfo<E> pageInfo = new PageInfo<>(list);
        baseRespModel.setTotal(pageInfo.getTotal());
        baseRespModel.setTotalPages(pageInfo.getPages());
        baseRespModel.setListData(list);
        return baseRespModel;
    }
}
